package com.atguigu.algorithm;

import java.util.Arrays;

public class NeitherLandProblem {
    public static void main(String[] args) {
        int[] a=new int[]{3,5,6,7,4,3,5,8};
        System.out.println(Arrays.toString(a));
        smallBig(a,5);
        System.out.println(Arrays.toString(a));
    }
    public static void smallBig(int[] a,int key){
        int L=0;
        int R=a.length-1;
        while(L<=R){
            while(L<=R && a[L]<=key){
                L++;
            }
            while(L<=R && a[R]>key){
                R--;
            }
            if(L<=R){
                int tmp=a[L];
                a[L]=a[R];
                a[R]=tmp;
            }
        }
    }
}
